package com.bw.task.order;

import com.bw.service.orders.IPiOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class OrderScheduling {
    private final Logger logger= LoggerFactory.getLogger(OrderScheduling.class);
    @Autowired
    private IPiOrderService orderService;

    /**
     * 定时扫单
     */
    @Scheduled(cron ="* * 0-2 * * ? " )
    public void orderTask(){
        logger.info("开始扫单");
        try {
            orderService.orderTask();
        } catch (Exception e){
            e.printStackTrace();
            logger.info("扫单异常");
        }
        System.out.println("--执行--");
    }
}
